package net.lijingye.education.entity;

import javax.persistence.*;
import java.io.Serializable;

/**
 * Created by LijingYe on 2016/4/4.
 */
@Entity
@Table(name = "friend")
public class Friend implements Serializable {
    @Id
    @OneToOne
    @JoinColumn(name = "userId")
    private User user;
    @Id
    @OneToOne
    @JoinColumn(name = "friendId")
    private User friend;

    public Friend() {
    }

    public Friend(User user, User friend) {
        this.user = user;
        this.friend = friend;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public User getFriend() {
        return friend;
    }

    public void setFriend(User friend) {
        this.friend = friend;
    }

    @Override
    public String toString() {
        return "Friend{" +
                "user=" + user.getId() +
                ", friend=" + friend.getId() +
                '}';
    }
}
